package com.example.animations.fragments;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.animations.R;

public class TransitionsFragment extends Fragment {
    private IOnDismissFragmentListener _onDismissListener;

    public TransitionsFragment(IOnDismissFragmentListener onDismissListener) {
        super(R.layout.fragment_transitions);
        _onDismissListener = onDismissListener;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);

        ((Button)view.findViewById(R.id.dismiss_button)).setOnClickListener(l -> {
            if (_onDismissListener != null) _onDismissListener.onDismissFragment();
        });

        return view;
    }

    public interface IOnDismissFragmentListener {
        void onDismissFragment();
    }
}
